Generic Zero-Cost Reuse for Dependent Types
نویسندگان
چکیده
Dependently typed languages are well known for having a problemwith code reuse. Traditional non-indexed algebraic datatypes (e.g. lists) appear alongside a plethora of indexed variations (e.g. vectors). Functions are often rewritten for both non-indexed and indexed versions of essentially the same datatype, which is a source of code duplication. We work in a Curry-style dependent type theory, where the same untyped term may be classified as both the non-indexed and indexed versions of a datatype. Many solutions have been proposed for the problem of dependently typed reuse, but we exploit Curry-style type theory in our solution to not only reuse data and programs, but do so at zero-cost (without a runtime penalty). Our work is an exercise in dependently typed generic programming, and internalizes the process of zero-cost reuse as the identity function in a Curry-style theory.
منابع مشابه
Development of a Generic Risk Matrix to Manage Project Risks
A generic risk matrix is presented for use identifying and assessing project risks quickly and cost effectively. It assists project managers with few resources to perform project risk analysis. The generic risk matrix (GRM) contains a broad set of risks that are categorized and ranked according to their potential impact and probability of occurrence. The matrix assists PMs in quickly identifyin...
متن کاملZero-Cost Coercions for Program and Proof Reuse
We introduce the notion of identity coercions between non-indexed and indexed variants of inductive datatypes, such as lists and vectors. An identity coercion translates one type to another such that the coercion function definitionally reduces to the identity function. This allows us to reuse vector programs to derive list programs (and vice versa), without any runtime cost. This also allows u...
متن کاملA cosmology of datatypes : reusability and dependent types
This dissertation defends the idea of a closed dependent type theory whose inductive types are encoded in a universe. Each inductive definition arises by interpreting its description – itself a firstclass citizen in the type theory. Datatype-generic programming thus becomes ordinary programming. This approach is illustrated by several generic programs. We then introduce an elaboration of induct...
متن کاملA Cost Analysis of the Jan Aushadhi Scheme in India
Medicines constitute a substantial proportion of out-of-pocket (OOP) expenses in Indian households. In order to address this issue, the Government of India launched the Jan Aushadhi (Medicine for the Masses) Scheme (JAS) to provide cheap generic medicines to the patients (http://janaushadhi.gov.in/about_jan_aushadhi.html). These medicines are provided through the Jan Aushadhi stores established...
متن کاملCreation of Views for Reuse of Software with Diierent Data Representations in the Automatic Programming Server Demo, Mathematical View Option. a Workstation Running X Windows Is Required
Personal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works must be obtained from the IEEE. Abstract Software reuse is inhibited by the many diierent ways in which e...
متن کامل